# 对所有方法进行并发测试
from concurrent.futures import ThreadPoolExecutor
import requests

def request_status_concurrently(method, code):
    url = f"https://httpbin.org/status/{code}"
    try:
        response = requests.request(method, url)
        return f"Method: {method}, Status: {response.status_code}"
    except requests.RequestException as e:
        return f"Error for {method}: {e}"

# 并发测试所有方法
methods = ["GET", "POST", "PUT", "PATCH", "DELETE"]
with ThreadPoolExecutor() as executor:
    futures = [executor.submit(request_status_concurrently, method, 200) for method in methods]
    for future in futures:
        print(future.result())
